package com.cold.demo.web.util;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SHAUtil {
    public static void main(String[] args) {
        printBkCj();
    }


    static Map<String,List<String>> bc = new HashMap<>();

    static {
        List<String> _1 = Arrays.asList("222", "政治", "化学培训班", "培训1", "高等数学研修班", "333", "111", "培训4班", "6666", "测试是是是", "化学提高班", "1025", "111", "培训5班", "测试班级", "班次名称01【周银昌】", "袁磊班", "刘某的测试班级", "222", "1111", "研究生一班", "数学培训班", "计算机培训班", "培训班三", "英语培训班", "物理培训班");
        List<String> _2 = Arrays.asList("境外1班", "0507测试");
        List<String> _3 = Arrays.asList("");
        List<String> _4 = Arrays.asList("333");
        List<String> _5 = Arrays.asList("涉外1班");
        bc.put("通用班次",_1);
        bc.put("境外班次",_2);
        bc.put("培训班次",_3);
        bc.put("研究生班次",_4);
        bc.put("涉外班次",_5);
    }


    //补考成绩
    private static void printBkCj(){
        for (int i = 2; i < 8; i++) {
            int[] cj = cj();
            int zf = cj[0] + cj[1] + cj[2];
            StringBuilder builder = new StringBuilder();
            builder.append(String.format("PX%s",new DecimalFormat("00000").format(i))).append('\t');
            builder.append("小明").append(i).append('\t');
            builder.append(getXq()).append('\t');
            builder.append(getKcmc()).append('\t');
            String bclx = getBclx();
            builder.append(bclx).append('\t');
            builder.append(getBcmc(bclx)).append('\t');
            builder.append(cjfs()).append('\t');
            builder.append(cjfs()).append("");
            System.out.println(builder);
        }
    }

    private static int cjfs(){
        return (int) (Math.random() * 100);
    }

    private static String getBcmc(String bclx){
        List<String> strings = bc.get(bclx);
        return strings.get(new BigDecimal(Math.random() * 10 % strings.size()).intValue());
    }

    private static String getBclx(){
        List<String> strings = Arrays.asList(bc.keySet().toArray(new String[bc.keySet().size()]));
        return strings.get(new BigDecimal(Math.random() * 10 % strings.size()).intValue());
    }

    private static String getKcmc(){
        List<String> strings = Arrays.asList("计算机基础", "dd", "kkkkkk", "ss", "测试教学计划zxlTest", "呜呜呜呜");
        return strings.get(new BigDecimal(Math.random() * 10 % strings.size()).intValue());
    }



    private static String getXq(){
        List<String> strings = Arrays.asList("2021-2022年度第一学期", "2020-2021年度第二学期", "2020-2021年度第一学期");
        return strings.get(new BigDecimal(Math.random() * 10 % strings.size()).intValue());
    }


    // 成绩
    private static void printCj() {
        for (int i = 2; i < 100; i++) {
            int[] cj = cj();
            int zf = cj[0] + cj[1] + cj[2];
            System.out.println(String.format("PX%s\t小张%d\t%d\t%d\t%d\t%d\t%d", new DecimalFormat("00000").format(i), i, cj[0], cj[1], cj[2], zf, 2));
        }
    }


    private static int[] cj() {
        // <= 30
        // <= 60
        // <= 10
        return new int[]{
                new BigDecimal(Math.random() * 0.3 * 100).intValue(),
                new BigDecimal(Math.random() * 0.6 * 100).intValue(),
                new BigDecimal(Math.random() * 0.1 * 100).intValue()};
    }
}
